import { Flex, Space } from 'antd'
import { ToolbarProps } from './ToolbarType'
import './Toolbar.less'

/**
 * 表格工具栏
 */
export const Toolbar = (props: ToolbarProps) => {
  const { component, left, right } = props
  // 工具栏由用户自主实现
  if (component) {
    return <div>{component}</div>
  }
  // 工具栏样式统一定义，内部组件由外部实现
  return (
    <Flex
      className="chunmi-page-toolbar"
      justify="space-between"
      align="center"
    >
      <div>{left}</div>
      <Space>{right}</Space>
    </Flex>
  )
}
